from django.db import models
from django.conf import settings

# Create your models here.
class News(models.Model):
	title = models.CharField(max_length=100)
	text = models.TextField()
	image = models.ImageField(upload_to='photos',default=None)
	publish_time = models.DateTimeField()
	summary = None
	def __unicode__(self):
		return self.title

	
	def get_summary(self):
		text = self.text
		if len(text)  < 160:
			summary = text[:len(text)/2]
		else:
			summary = text[:80]
		self.summary = summary

		return summary

class SchoolDisplay(models.Model):
	carousel_iamges = models.ImageField(upload_to='schoolDisplay',default=None)
	title = models.CharField(max_length=30)
	descrption = models.CharField(max_length=300)
	special_mark = models.CharField(max_length=80)

class DynamicInfo(models.Model):
	title= models.CharField(max_length=30)
	description = models.CharField(max_length=300)
	date = models.DateTimeField()


class PushInfos(models.Model):
	title=models.CharField(max_length=20)
	date= models.DateTimeField()
	des = models.CharField(max_length=200)
